home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 084 (1990-10)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 084 (1990-10)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / MakeC / iffinfo.c < prev    next >
C/C++ Source or Header  |  1990-09-20  |  2KB  |  56 lines

  1. /*
  2.     A quick program to let you know what a picture looks like
  3.     as far as size, colors, etc.  Must link with "iff_stuff.o"
  4. */
  5.  
  6. #include "iff.h"
  7. #include <stdio.h>
  8.  
  9. main(argc,argv)
  10. int argc;
  11. char **argv;
  12. {
  13.     BitMapHeader header;    /* somewhere to put the info */
  14.     int error;                /* bailout flag */
  15.     FILE *ifffile;            /* the file */
  16.     
  17.     if(argc<2)                /* hey bonehead -- RTFM !! */
  18.         {
  19.             printf("\nUsage is:  %s <iff_filename>.\n",argv[0]);
  20.             exit(5);
  21.         }
  22.     if((ifffile=fopen(argv[1],"rb"))==NULL)    /* open up the file */
  23.         {
  24.             printf("\nIFF file could not be opened!\n");
  25.             exit(5);
  26.         }
  27.     if(error=GetBMHD(ifffile,&header))        /* scan the info into header */
  28.         {
  29.             printf("\nFile is invalid or not IFF.\n");
  30.             fclose(ifffile);
  31.             exit(5);
  32.         }                                /* tell it like it is.... */
  33.     printf("\nInformation for IFF file %s -->\n\n",argv[1]);
  34.     printf("Picture is %u pixels wide by %u pixels high.\n",
  35.                     header.w,header.h);
  36.     printf("Picture is displayed at %d, %d relative to screen.\n",
  37.                     header.x,header.y);
  38.     printf("Picture has %d bitplanes.\n",header.nplanes);
  39.     if(header.masking & mskHasMask)
  40.         printf("Picture has a mask plane.\n");
  41.     if(header.masking & mskHasTransparentColor)
  42.         printf("Picture has a transparent color in register %d.\n",
  43.                     header.TransparentColor);
  44.     if(header.masking & mskLasso)
  45.         printf("Picture has a lasso-style mask.\n");
  46.     if(header.compression == cmpByteRun1)
  47.         printf("Picture is compressed with ByteRun1 encoding.\n");
  48.     printf("Picture has an aspect ratio of %u : %u. (x:y)\n",
  49.                     header.xAspect,header.yAspect);
  50.     printf("Picture has a page size of %d pixels wide by %d pixels high.\n\n",
  51.                     header.pageWidth,header.pageHeight);
  52.     fclose(ifffile);
  53.     exit(0);
  54. }
  55.  
  56.